
package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Ability;
import com.ruoyi.busi.guide.service.IAbilityService;

/**
 * 导师能力Controller
 */
@RestController
@RequestMapping("/busi/guide/ability")
public class AbilityController extends BaseController {
    @Autowired
    private IAbilityService abilityService;

    /**
     * 根据导师ID获取能力评估
     */
    @GetMapping("/mentor/{mentorId}")
    public R getByMentorId(@PathVariable Long mentorId) {
        return R.ok(abilityService.selectByMentorId(mentorId));
    }

    /**
     * 查询能力评分高于指定值的导师列表
     */
    @GetMapping("/score")
    public R listByMinScore(
        @RequestParam String abilityType,
        @RequestParam Double minScore) {
        return R.ok(abilityService.selectByMinScore(abilityType, minScore));
    }

    /**
     * 新增能力评估
     */
    @PostMapping
    public R add(@RequestBody Ability ability) {
        return R.ok(abilityService.save(ability));
    }

    /**
     * 修改能力评估
     */
    @PutMapping
    public R edit(@RequestBody Ability ability) {
        return R.ok(abilityService.updateById(ability));
    }

    /**
     * 删除能力评估
     */
    @DeleteMapping("/{abilityIds}")
    public R remove(@PathVariable List<Long> abilityIds) {
        return R.ok(abilityService.deleteAbilityByIds(abilityIds));
    }
}
